Modular/Multifunction Program

What is a Modular/Multifunction Program?

A modular or multifunction program is one that is divided into several smaller, self-contained functions. Each function performs a specific task, making the entire program easier to understand, maintain, and debug.

Example: Modular Program for Calculating Area of Different Shapes

#include < stdio.h>
float area_of_circle(float radius) {
    return 3.14 * radius * radius;
}
float area_of_rectangle(float length, float width) {
    return length * width;
}
int main() 
{
    float radius = 5.0, length = 10.0, width = 4.0;
    printf("Area of circle: %.2f\n", area_of_circle(radius));
    printf("Area of rectangle: %.2f\n", area_of_rectangle(length, width));
    return 0;
}